#include "item.h"
#include "constants.h"
#include "gl\gl.h"
#include "gl\glu.h"
#include "gl\glut.h"
#include <math.h>

Item::Item(float _x, float _y, float _z, int r, int g, int b, double _duration, t3DModel *_model)
{
	position = Vector(_x, _y, _z);
	duration = _duration;
	model = _model;
	model->setColor(r, g, b);
	time(&gained);
	gained -= 120;
}

void Item::draw(float angle)
{
	glPushMatrix();
	glTranslatef(position[0], position[1] + sin((angle/360)*Constants::PI)/10, position[2]);
	glRotatef(angle, 0, 1, 0);

	model->draw(0, 0, 0);
	glRotatef(-angle, 0, 1, 0);
	glTranslatef(-position[0], -position[1] - sin((angle/360)*Constants::PI)/10, -position[2]);
	glPopMatrix();
}